﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace QuanLyKho
{
    public partial class frm_About : Form
    {
         private Point prevLeftClick;
        private bool isFirst = true;
        private bool toBlock = true;

        
        public frm_About()
        {
            InitializeComponent();
            Bitmap bmForm = QuanLyKho.Properties.Resources.back;
            Bitmap bmExit = QuanLyKho.Properties.Resources.x;
            about.CreateRegion(this, bmForm);
            about.CreateRegion(btnExit, bmExit);
        }

        private void btnExit_Click(object sender, EventArgs e)
        {
            
            MessageBox.Show("Đang thoát ...");
            Close();
        }

        private void Form1_MouseMove(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
              if (isFirst == true)
                {
                    prevLeftClick = new Point(e.X, e.Y);
                    isFirst = false;
                }
                else
                {
                    if (toBlock == false)
                        this.Location = new Point(this.Location.X + e.X - prevLeftClick.X, this.Location.Y + e.Y - prevLeftClick.Y);

                    prevLeftClick = new Point(e.X, e.Y);
                    toBlock = !toBlock;
                }
            }
            else
                isFirst = true;
        }

        private void btnExit_Click_1(object sender, EventArgs e)
        {
            Application.Exit();
        }
    }
}
